<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品采购申请</title>
    <!-- 引入element-ui样式 -->
    <link rel="stylesheet" href="../../../plugins/element-ui/index.css">
</head>
<body>

<div id="app">

    <el-container style="height: 800px; border: 1px solid #eee">
        <el-container>
            <div style="width: 100%;position: relative">

                <div style=";margin-bottom: 80px;">
                    <el-input
                            placeholder="请输入商品名"
                            clearable
                            style="width: 20%; "
                            prefix-icon="el-icon-search"
                            v-model="Query.name"
                    >
                    </el-input>
                    <el-button @click="getAll()" class="dalfBut">查询</el-button>
                </div>


                <el-table   size="medium" current-row-key="id"  :data="dataList" stripe highlight-current-row>
                    <el-table-column type="index" align="center" label="序号"></el-table-column>
<!--                    <el-table-column prop="jobNumber" label="员工工号" align="center"></el-table-column>-->
<!--                    <el-table-column prop="buyerName" label="员工名" align="center"></el-table-column>-->
                    <el-table-column prop="name" label="菜名" align="center"></el-table-column>
                    <el-table-column prop="typeName" label="分类" align="center"></el-table-column>
                    <el-table-column prop="price" label="价格" align="center"></el-table-column>
                    <el-table-column prop="number" label="数量" align="center"></el-table-column>
                    <el-table-column prop="total" label="总价" align="center"></el-table-column>
                    <el-table-column prop="time" label="采购时间" align="center"></el-table-column>
<!--                    <el-table-column prop="status" label="申请状态" align="center"></el-table-column>-->

<!--                    <el-table-column label="操作" align="center">-->
<!--                        <template slot-scope="scope">-->
<!--                            <el-button type="primary"  size="mini" @click="updateStatus(scope.row,1)">通过</el-button>-->
<!--                            <el-button type="danger"  size="mini" @click="updateStatus(scope.row,2)">否决</el-button>-->
<!--                        </template>-->
<!--                    </el-table-column>-->
                </el-table>

                <!--分页组件-->
                <el-pagination
                        class="pagination"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-size="pagination.pageSize"
                        layout="total, prev, pager, next, jumper"
                        :total="pagination.total">
                </el-pagination>

            </div>
        </el-container>
    </el-container>

</div>


<script src="../../../plugins/vue/vue.js"></script>

<!-- 引入element-ui组件库 -->
<script src="../../../plugins/element-ui/index.js"></script>

<!-- 引入axios -->
<script src="../../../plugins/axios/axios.min.js"></script>

<script>
    new Vue({
        el:'#app',    //element
        data:{

            //显示的数据
            dataList:[],

            //工号搜索内容1
            Query:{
                name:""
            },
            pagination: {
                //分页相关模型数据 1
                currentPage: 1,//当前页码1
                pageSize:5,//每页显示的记录数1
                total:0,//总记录数1
            },

        },

        created() {
            const adminInfo = window.localStorage.getItem('buyer')
            console.log("adminInfo1:::"+adminInfo)
            if (adminInfo) {
                this.adminInfo = JSON.parse(adminInfo)
            }
            console.log(this.adminInfo)

            this.getAll();
        },

        methods:{
            getAll(){
                //将自己的name传过去 获取自己的采购信息
                parent ="?name="+this.Query.name;

                //显示当前登录采购员的采购信息
                axios.get("/goodsBuys/getPageGoodsBuyByStatus/"+this.pagination.currentPage+"/"+this.pagination.pageSize+parent).then((res)=>{

                    console.log("res:")
                    console.log(res)

                    this.dataList=res.data.data.records
                    this.pagination.total=res.data.data.total
                    this.Query.name=""
                })
            },
            //切换页码
            handleCurrentChange(currentPage) {
                console.log("切换页码:")
                this.pagination.currentPage=currentPage;
                console.log(currentPage)
                this.getAll();
            },

            getImage (image) {
                this.imageUrl1= `/files/downloadFile?name=${image}`
            },
        }
    })

</script>
</body>
</html>